home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics & Sound Program…ng Techniques for the Mac
/
Graphics and Sound Programming Techniques for the Mac.iso
/
Goodies
/
Animation Libraries
/
GENetRelease2ƒ
/
GETest
/
GELogo.c
next >
Wrap
Text File
|
1994-06-10
|
2KB
|
90 lines
/*
GELogo.c
Graphic Elements © 1994 floating sign
Copyright 1994 by Al Evans. All rights reserved.
5/31/94
*/
#include "GELogo.h"
#include "SFXCtrlr.h"
#include "SFXProcs.h"
typedef struct {
Boolean signOn;
RGBColor color[2];
} BlinkRec, *BlinkRecPtr;
BlinkRec logoBlink;
Str255 logoText = "\pGraphic Elements";
Str255 line2 = "\p©1994 by Al Evans";
Boolean LoadLogoScene(GEWorldPtr world)
{
GrafElPtr logoElement;
GrafElPtr secondLine;
short fontNum;
GrafElPtr ctrlr;
GetFNum("\pPalatino", &fontNum);
logoBlink.signOn = false;
logoBlink.color[0].red = 194 << 8;
logoBlink.color[0].green = 194 << 8;
logoBlink.color[0].blue = 0;
logoBlink.color[1].red = 240 << 8;
logoBlink.color[1].green = 240 << 8;
logoBlink.color[1].blue = 46 << 8;
//Create sign
logoElement = NewTextGraphic(world, logoID, logoPlane, 0, 0, srcOr,
fontNum, bold, 24, logoBlink.color[0], logoText);
if (!logoElement) return false;
secondLine = NewTextGraphic(world, logoID+1, logoPlane + 1, 0, 0, srcOr,
fontNum, 0, 14, logoBlink.color[0], line2);
if (!secondLine) return false;
//Position two lines --
//first line horizontally centered a little above middle of world,
//second line centered beneath first line
PtrMoveElementTo(world, logoElement,
(RectWidth(&world->animationRect) - RectWidth(&logoElement->animationRect)) / 2,
(RectHeight(&world->animationRect) - RectHeight(&logoElement->animationRect)) / 2 -
ScaleToWorld(world, 36), false);
PtrMoveElementTo(world, secondLine, logoElement->animationRect.left +
((RectWidth(&logoElement->animationRect) - RectWidth(&secondLine->animationRect)) / 2),
logoElement->animationRect.bottom, false);
//Set up blinking action
SetCollision(world, logoID, DoLogoHit, 400);
//Try for special effect...
ctrlr = DoGESFX(world, 'SFX ', logoElement, SFXVWipe, 20, 2000, 60, true, false);
ctrlr = DoGESFX(world, 'SFX1', secondLine, SFXHWipe, 20, 5000, 60, true, false);
return true;
}
pascal void DoLogoHit(GEWorldPtr world, GrafElPtr logo, GEDirection dir,
CollisionPhase phase, GrafElPtr objHit)
{
switch (phase) {
case collisionBegin:
((TextGraphicPtr) logo)->tgColor = logoBlink.color[true];
ChangedRect(world, &logo->animationRect);
break;
case collisionContinue:
break;
case collisionEnd:
((TextGraphicPtr) logo)->tgColor = logoBlink.color[false];
ChangedRect(world, &logo->animationRect);
break;
}
}